package cn.com.bluemoon.daps.webhook.api;

import cn.com.bluemoon.daps.common.constant.ServiceNameConstants;
import cn.com.bluemoon.daps.common.domain.ResultBean;
import cn.com.bluemoon.daps.webhook.api.factory.RemoteWebhookFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * biaozhun服务
 *
 * @author Jarod Kong
 */
@FeignClient(value = ServiceNameConstants.DapsApiDomp.WEBHOOK_SERVICE, fallbackFactory = RemoteWebhookFallbackFactory.class)
public interface RemoteWebhookService {
    /**
     * @param map  http://gitlab.admin.bluemoon.com.cn/help/user/project/integrations/webhooks
     * @param type
     * @return
     */
    @PostMapping(value = "/webhook")
    ResultBean<String> ok(@RequestBody Map<String, Object> map,
                          @RequestParam(value = "type", defaultValue = "1") Integer type,
                          @RequestParam(value = "gitRefRegex", required = false) String gitRefRegex);
}
